<template>
  <div>
    <!-- 骨架屏 -->
    <van-skeleton style="margin-top:80px" title :row="6" v-if="!mainList.name"/>
    <!-- tabs切换 -->
    <van-tabs v-model="active" v-else>
      <van-tab title="主商品"><Main :mainList="mainList"></Main></van-tab>
      <van-tab title="附属商品"><Subsidiary :SubsidiaryList="SubsidiaryList"></Subsidiary></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import Main from './Main'
import Subsidiary from './Subsidiary'
import {getProjectGoodsAPI} from '@/api'
export default {
  name: 'GoodsVue',
  components: {
    Main,
    Subsidiary
  },
  data() {
    return {
      active: 0,
      // 附属商品信息
      SubsidiaryList:{},
      // 主商品信息
      mainList:{}
    }
  },
  created() {
    this.getData()
  },
  methods: {
    async getData() {
      const res = await getProjectGoodsAPI()
      console.log(res);
      const {SubsidiaryList,mainList} = res.data.data
      this.SubsidiaryList=SubsidiaryList
      this.mainList=mainList
      
    }
  }
}
</script>

<style>
</style>